﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Iacym.Entities;
using Iacym.BusinessLogic;
using Microsoft.Practices.Unity;

namespace Iacym.UI
{
    public partial class FrmCumpleaños : Form
    {
        [Dependency]
        public IPersonaBL personaBL { get; set; }
        public FrmCumpleaños()
        {
            InitializeComponent();
            this.BuildUp();
        }

        private void FrmCumpleaños_Load(object sender, EventArgs e)
        {
            //dtpFecha.Text = "27/03/2014";
            //pERSONABindingSource1.DataSource = personaBL.GetAllFromPersona();
            cargaCumpleaños();
        }

        public void cargaCumpleaños()
        {
            var a = dtpFecNacIni.Value = dtpFecha.Value.AddDays(14);
            var b = dtpFecNacFin.Value = dtpFecNacIni.Value.AddDays(30);
            var mes = DateTime.Now.Date.Month;
            //pERSONABindingSource1.DataSource = personaBL.GetAllFromPersonaByFechaNac(Convert.ToInt32(a.Month.ToString()), Convert.ToInt32(b.Month.ToString()));
            pERSONABindingSource1.DataSource = personaBL.GetAllFromPersonaByFechaNac(mes, (mes+1));
        }

        private void btnGenerar_Click(object sender, EventArgs e)
        {
            var a = dtpFecNacIni.Value = dtpFecha.Value.AddDays(14);
            var b = dtpFecNacFin.Value = dtpFecNacIni.Value.AddDays(30);
            pERSONABindingSource1.DataSource = personaBL.GetAllFromPersonaByFechaNac(Convert.ToInt32(a.Month.ToString()), Convert.ToInt32(b.Month.ToString()));
            //cargaCumpleaños();
        }

        private void btnReporteCumple_Click(object sender, EventArgs e)
        {
            var cumple = new Reportes.frmReporteCumpleaños();
            cumple.ShowDialog();
        }
    }
}
